package com.yyh1;

public class Book {
    //属性
    //图书编号
    private int id;
    //书名
    private String name;
    //价格
    private double price;
    //无参构造方法
    public Book() {
    }
    //有参构造方法
    public Book(int id, String name, double price) {
        this.id = id;
        this.name = name;
        this.price = price;
    }
    //getter and setter
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
    //行为
    //打印信息
    public void show(){
        System.out.println("图书编号："+id+"书名："+name+"价格："+price);
    }
}
